package com.boshao.classschedule.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;

import com.boshao.classschedule.R;

/**
 * 提醒Activity
 * @author boshao
 *
 */
public class AlarmActivity extends Activity{
	MediaPlayer alarmMusic;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Intent intent = getIntent();
		String des = intent.getStringExtra("activityName");//获取提醒日程的名字
		
		//指定音乐
		alarmMusic = MediaPlayer.create(this, R.raw.deep);
		//播放音乐
		alarmMusic.start();
		
		new AlertDialog.Builder(AlarmActivity.this).setTitle("日程提醒")
			.setMessage(des)
			.setPositiveButton("关闭提醒", new OnClickListener() {
				
				@Override
				public void onClick(DialogInterface dialog, int which) {
					alarmMusic.stop();
					AlarmActivity.this.finish();
				}
			}).show();
	}
}
